package com.maigao.entity.enums;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

/**
 * @program: maigao
 * @description:
 * @author: yongza
 * @create: 2024-10-26 23:24
 **/
public enum Week {
    PRE(-1), CURRENT(0), NEXT(1);

    Week(int value) {
        this.value = value;
    }

    private int value;

    public int getValue() {
        return value;
    }

    public static Week getByValue(int value) {
        Optional<Week> optional = Arrays.stream(values()).filter(p -> Objects.equals(p.getValue(), value)).findFirst();
        if (optional.isPresent()) {
            return optional.get();
        }
        return null;
    }
}
